package com.qingcloud.adminbackend.mapper;

import com.qingcloud.adminbackend.entity.sensor.SensorParamDTO;
import com.qingcloud.adminbackend.entity.sensor.SysSensor;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qingcloud.adminbackend.entity.sensor.SysSensorDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 设备传感器数据表 Mapper 接口
 * </p>
 *
 * @author luozehua
 * @since 2019-04-16
 */
public interface SysSensorMapper extends BaseMapper<SysSensor> {

    Integer updateBind(@Param("sensorId") String sensorId, @Param("equipmentId") String equipmentId);

    int existSensor(@Param("sensorId") String sensorId);

    /**
     * 传感器详情
     *
     * @param equipmentId
     * @return
     */
    List<SysSensorDTO> sensorDetails(@Param("equipmentId") String equipmentId);

    /**
     * 指定的传感器是否已经在使用
     *
     * @param sensorId
     * @return
     */
    Integer inUser(@Param("sensorId") String sensorId);

    /**
     * 闲置传感器
     *
     * @param sensorId
     * @return
     */
    SysSensor inIdel(@Param("sensorId") String sensorId);

    /**
     * 验证传感器是否存在
     *
     * @param sensorIds
     * @return
     */
    List<String> existSensors(@Param("sensorIds") List<String> sensorIds);

    /**
     * 批量添加传感器
     *
     * @param sensorParams
     * @return
     */
    int insertSensors(@Param("sensorParams") List<SensorParamDTO> sensorParams);

    Integer updateStatus(@Param("equipmentIds") List<String> equipmentIds, @Param("status") Integer status);
}
